package com.zyong.design.pattern.flyweight.case1;

/**
 * @program: zyong-design-pattern
 * @ClassName: Client
 * @author: zyong
 * @create: 2024-04-05 00:03
 */
public class Client {
    public static void main(String[] args) {
        FlyWeight shareInstance = FlyWeightFactory.getShareInstance("1");
        shareInstance.operation();

        FlyWeight unSharedInstance = FlyWeightFactory.getUnSharedInstance();
        unSharedInstance.operation();

        FlyWeight shareInstance2 = FlyWeightFactory.getShareInstance("2");
        System.out.println("shareInstance = shareInstance2 ? " + (shareInstance == shareInstance2));

        FlyWeight shareInstance3 = FlyWeightFactory.getShareInstance("1");
        System.out.println("shareInstance = shareInstance3 ? " + (shareInstance == shareInstance3));
    }
}
